#!/usr/bin/perl
use utf8;
use strict;

sub average {
	my ($avg, $sum);
	foreach (@_) {
		$sum += $_;
	}
	$avg = $sum / @_;
}

sub above_average {
	my $avg = &average (@_);
	my @above_average_number = ();
	foreach(@_) {
		if ($_ > $avg) {
			push @above_average_number, $_;
		}
	}
	@above_average_number;
}

my @fred = above_average (1..10);
print "\@fred is @fred\n";
print "(shoud be 6 7 8 9 10)\n";
my @barney = above_average(100, 1..10);
print "\@barney is @barney\n";
print "(should be just 100)\n";